/**
 * @Project TMHSC
 * @Author Tran Manh Hung
 * @Email: hungtmit@gmail.com | tmh@xwebgate.com
 * @Copyright © 2011 TMH. All rights reserved
 * @Createdate Feb 10, 2011
 * @Createtime 4:35:14 PM
 */

package com.tmh.study.fMVW
{
	import flash.display.MovieClip;

	public class World extends MovieClip
	{
		public var map:IsometricMapData;

		public var avatarList:Array = new Array();

		public var myAvatar:WalkingAvatar;

		public function World()
		{
			super();
		}
	}

	private function onKeyboardDown(e:Event):void
	{
		var c:uint = e.target.lastKey;

		if (c)
		{
			if (c == Keyboard.LEFT)
			{
				_myAvatar.walkTo(-1, 0);
			}
			else if (c == Keyboard.RIGHT)
			{
				_myAvatar.walkTo(1, 0);
			}
			else if (c == Keyboard.UP)
			{
				/* Please note that Y is positive down */
				_myAvatar.walkTo(0, -1);
			}
			else if (c == Keyboard.DOWN)
			{
				_myAvatar.walkTo(0, 1);
			}
		}
	}

	private function onKeyboardUp(e:Event):void
	{
		myAvatar.stopWalk();
	}
}